﻿using System;
using System.Collections.Generic;
using CrateMayhem.Common.Services;

namespace CrateMayhem.Desktop.Services
{
    public class ServiceFactory : IServiceFactory
    {
        private static readonly Dictionary<Type, IService> services = new Dictionary<Type, IService>
            {
                {typeof(IGameService), Global.Container.Resolve<IGameService>()},
                {typeof(IGameSettingsService), Global.Container.Resolve<IGameSettingsService>()},
                {typeof(IAutoCloseDialogService), Global.Container.Resolve<IAutoCloseDialogService>()},
                {typeof(IMessageService), Global.Container.Resolve<IMessageService>()}
            };

        public TService Create<TService>() where TService : IService
        {
            return (TService)services[typeof (TService)];
        }
    }
}